package com.tencet.servlet;

import com.tencet.entity.Earn;
import com.tencet.service.EarnService;
import com.tencet.service.Impl.AccountTwoServiceImpl;
import com.tencet.service.Impl.EarnServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/earn")
public class EaenServlet extends HttpServlet {
    EarnService earnService = new EarnServiceImpl();
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        int e_num = Integer.parseInt(req.getParameter("e_num"));
        String o= (String) req.getSession().getAttribute("secondAccountNumber");
        AccountTwoServiceImpl accountTwoService = new AccountTwoServiceImpl();

        Earn earn = new Earn(o,e_num);
        int i = earnService.addEarn(earn);
        req.getRequestDispatcher("account_index.jsp").forward(req,resp);



    }
}
